<#function resolveChannel path>
  <#local c = cms.resolveChannel(channel, path) />  
  <#return c />
</#function>

<#macro banner>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="974" height="128">
  <param name="movie" value="/static/images/banner.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="opaque" />
  <param name="swfversion" value="9.0.45.0" />
  <!-- 此 param 标签提示使用 Flash Player 6.0 r65 和更高版本的用户下载最新版本的 Flash Player。如果您不想让用户看到该提示，请将其删除。 -->
  <param name="expressinstall" value="/static/scripts/expressInstall.swf" />
  <!-- 下一个对象标签用于非 IE 浏览器。所以使用 IECC 将其从 IE 隐藏。 -->
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="/static/images/banner.swf" width="974" height="128">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="9.0.45.0" />
    <param name="expressinstall" value="/static/scripts/expressInstall.swf" />
    <!-- 浏览器将以下替代内容显示给使用 Flash Player 6.0 和更低版本的用户。 -->
    <div>
      <h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4>
      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="获取 Adobe Flash Player" width="112" height="33" /></a></p>
    </div>
    <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>
</#macro>

<#macro search site="www.hzcopyright.com">
<form action="http://www.google.com.hk/search" method="get">
<input name="sitesearch" value="${site}" type="hidden">
<input name="hl" value="zh-CN" type="hidden">
<input name="ie" value="UTF-8" type="hidden">
<input size="25" name="q" id="query" value="" type="text">
<input name="Search" value="搜索" attr="value" type="submit">
</form>
</#macro>

<#macro analytics account="UA-16756394-1" >
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '${account}']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</#macro> 

<#macro announcement path start=0 limit=0 maxWidth=0 dateFormat="">
  <#local ch = resolveChannel(path) />
  <#local list=cms.getArticles(ch.id,start,limit) />
  <#if (list?size > 0) >
    <div id="announcement" class="slideshow verticalSlideshow">
      <div class="slideHolder">
        <#list list as item>
          <#if item_index==0>
            <#local cls="slide current"/>
          <#else>
            <#local cls="slide"/>
          </#if>
          <#if (item.url)??>
            <#local url=item.url/>
          <#else>
            <#local url=ch.path+"a-"+item.id+".html"/>
          </#if>
          <div class="${cls}">
            <a href="${url}" title="${item.title!}">${cms.abbreviate(item.title,maxWidth)}
              <#if dateFormat?has_content><em>${item.lastModified?string(dateFormat)}</em></#if>
            </a>
          </div>
        </#list>
      </div>
    </div>  
  </#if>
</#macro>

<#macro slideshow>
  <div id="slideshow" class="slideshow">
    <div class="slideHolder">
      <#local list = cms.getSlideShow(1,5)/>
      <#if (list?size > 0) >
        <#list list as item>
          <#if item_index==0>
            <#local cls="slide current"/>
          <#else>
            <#local cls="slide"/>
          </#if>
          <#local a=cms.getArticle(item.articleId)/>
          <#if a??>
            <#if a.url??>
              <#local url=a.url/>
            <#else>
              <#local url="a-"+a.id+".html"/>
            </#if>
            <div class="${cls}"><a href="${url}" title="${a.title!}"><img src="/attachments/${(item.id)!}/${item.filename?url}" alt="${(item.title)!}" /><span class="slideText">${a.title!}</span></a></div>
          <#else>
            <div class="${cls}"><img src="/attachments/${(item.id)!}/${item.filename?url}" alt="${(item.title)!}" /><span class="slideText">${(item.title)!}</span></div>
          </#if>
        </#list>
      </#if>
    </div>
  </div>
</#macro>


<#macro links>
  <ul>
    <li><a href="http://www.zjxwcb.gov.cn/" target="_blank">浙江省新闻出版局（版权局）</a></li>
    <li><a href="http://www.ncac.gov.cn/" target="_blank">国家版权局 </a></li>
    <li><a href="http://www.mcsc.com.cn" target="_blank">中国音乐著作权协会</a></li>
    <li><a href="http://www.ccopyright.com.cn" target="_blank">中国版权信息网</a></li>
    <li><a href="http://www.zhipr.com/" target="_blank">中华版权网</a></li>
  </ul>
</#macro>

<#macro title>${(article.title)!(channel.title)!}</#macro> 

<#macro subject>${(article.subject)!}</#macro> 

<#macro keywords>${(article.keywords)!(channel.keywords)!}</#macro> 

<#macro description>${(article.description)!(channel.description)!}</#macro> 

<#macro author>${(article.author)!}</#macro> 

<#macro source>${(article.source)!}</#macro> 

<#macro summary>${(article.summary)!}</#macro> 

<#macro content>${(article.content)!}</#macro> 

<#macro lastModified dateFormat="yyyy-MM-dd HH:mm:ss">${(article.lastModified?string(dateFormat))!}</#macro> 

<#macro attachments title="附件下载">
  <#if (article.id)??>
    <#local list = cms.getAttachments(article.id)/>
    <#if (list?size > 0) >
      <dl class="x-attachment">
        <dt>${title!}</dt>
        <#list list as item>
          <dd><a href="/downloads/${(item.id)!}/${item.filename?url}" title="${(item.title)!}">${(item.title)!}</a></dd>
        </#list>
      </dl>
    </#if>
  </#if>
</#macro> 

<#macro articleText>
  <article>
    <h1 id="blkArticleTitle"><@title /></h1>
    <#if (article.subject)??><h2 id="blkArticleSubject"><@subject /></h2></#if> 
    <div id="blkArticleInfo">
      <#if (article.author)??><span id="blkArticleAuthor"><@author /></span></#if> 
      <#if (article.source)??><span id="blkArticleSource"><@source /></span></#if>  
      <#if (article.lastModified)??><span id="blkArticleLastModified"><@lastModified /></span></#if> 
    </div>
    <#if (article.summary)??><div id="blkArticleSummary"><@summary /></div></#if>
    <div id="blkArticleContent"><@content /></div>
    <div id="blkAttachments"><@attachments /></div>
  </article>
</#macro> 

<#macro text>
  <#if article??>
  <#else>
    <#local list=cms.getArticles(channel.id,0,1)/>
    <#if list?has_content>
      <#assign article=list[0] />
    </#if>    
  </#if>
  <@articleText/>
</#macro>

<#macro channelLink channel target="">
  <#if (channel.url)??>
    <#local url=channel.url />
  <#else>  
    <#local url=""+channel.path />
  </#if>
  <a href="${url}" title="${channel.title!}" <#if target?has_content> target="${target}"</#if>>${channel.title!}</a>
</#macro> 



<#macro link path="" target="">
  <#local c = resolveChannel(path) />
  <#if c??><@channelLink channel=c target=target/></#if>
</#macro> 

<#macro moreLink channel text="..." target="">
  <#if (channel.url)??>
    <#local url=channel.url />
  <#else>  
    <#local url=""+channel.path />
  </#if>
  <a href="${url}" title="${channel.title!}" <#if target?has_content> target="${target}"</#if>>${text}</a>
</#macro>

<#macro more path="" text="更多..." target="">
  <#local c = resolveChannel(path) />
  <#if c??><@moreLink channel=c text=text target=target/></#if>
</#macro>


<#macro breadcrumb>
  <#local list = cms.getBreadcrumb((channel.id)!)/>
  <#if (list?size > 0) >
    <ul class="x-breadcrumb">
      <#list list as item>
        <#if item_has_next>
          <li class="x-breadcrumb-item"><@channelLink channel=item /> &gt</li>  
        <#else>
          <li class="x-breadcrumb-last"><@channelLink channel=item /></li>        
        </#if>
      </#list>
    </ul>
  </#if>
</#macro> 

<#macro channelChildren channel limit=0 >
  <#if (channel.id)??>
    <#local list = cms.getTopChannels(channel.id,limit)/>
    <#if list?has_content>
      <ul>
        <#list list as item>
          <li><@channelLink channel=item /></li>
        </#list>
      </ul>
    </#if>
  </#if>
</#macro>

<#macro children path="" limit=0>
  <#local c = resolveChannel(path) />
  <@channelChildren channel=c limit=limit />
</#macro>

<#macro siblingChannel channel>
  <#if (channel.parentId)??>
    <#local list = cms.getChannels(channel.parentId)/>
    <#if list?has_content>
      <ul>
        <#list list as item>
          <li><@channelLink channel=item /></li>
        </#list>
      </ul>
    </#if>
  </#if>
</#macro>

<#macro sibling path="">
  <#local c = resolveChannel(path) />
  <@siblingChannel channel=c />
</#macro>

<#macro menuItems parent deep=2>
  <#local current = (channel.id)! />
  <#if (parent.id)??>
    <#local list = cms.getChannels(parent.id)/>
    <#if list?has_content>
      <ul id="menu-${parent.name}">
        <#list list as item>
          <li class="x-menuitem-${deep}">
            <#if current == item.id >
              <strong>${item.title!}</strong>
            <#else>
              <@channelLink item />
            </#if>
            <#if (deep >1) >
              <@menuItems item deep-1/>
            </#if>
          </li>
        </#list>
      </ul>
    </#if>
  </#if>
</#macro>

<#macro menu root="" deep=2>
  <#local c = resolveChannel(root) />
  <@menuItems parent=c deep=deep />
</#macro>

<#macro channelArticles channel start=0 limit=0 maxWidth=0 dateFormat="">
  <#if (channel.id)??>
    <#local list=cms.getArticles(channel.id,start,limit)/>
    <#if (list?size > 0) >
      <ul class="x-article-list">      
        <#list list as item>
        <li>
          <#if (item.url)??>
            <a href="${item.url}" title="${item.title}">${cms.abbreviate(item.title,maxWidth)}</a>
          <#else>
            <a href="${channel.path}a-${item.id}.html" title="${item.title}">${cms.abbreviate(item.title,maxWidth)}</a>
          </#if>
          <#if dateFormat?has_content><em>${item.lastModified?string(dateFormat)}</em></#if>
        </li>
        </#list>
      </ul>  
    </#if>
  </#if>
</#macro> 

<#macro pages pageSize=20>
  <#if (channel.id)??>
    <#local count=cms.getArticleCount(channel.id)/>
    <#if (count >0)>
      <#local pages=(count/pageSize)?ceiling/>
      <ul class="x-page-nav">
        <li class="x-page-previous">
          <#if ((pageIndex!0)>0)>
            <a href="${channel.path}index-${(pageIndex!0)-1}.html" title="上一页">上一页 </a>
          <#else>
          <span>&nbsp;</span> 
          </#if>
        </li>
        <li class="x-page">第 ${(pageIndex!0)+1}/${pages} 页</li>
        <li class="x-page-next">      
          <#if ((pageIndex!0)<(pages-1))>
            <a href="${channel.path}index-${(pageIndex!0)+1}.html" title="下一页">下一页 </a>
          <#else>
            <span>&nbsp;</span>
          </#if>
        </li>
      </ul>
    </#if>  
  </#if>
</#macro> 

<#macro articles path="" start=0 limit=0 maxWidth=0 dateFormat="">
  <#local ch = resolveChannel(path) />
  <#if ch??>
   <@channelArticles channel=ch start=start limit=limit maxWidth=maxWidth dateFormat=dateFormat />
  </#if>
</#macro> 
  
<#macro articleList pageSize=20 showPageNav=true maxWidth=0 dateFormat="">
  <#if channel??>
    <@channelArticles channel=channel start=(pageIndex!0)*pageSize limit=pageSize maxWidth=maxWidth dateFormat=dateFormat />
    <#if showPageNav>
      <div id="pages">
        <@pages pageSize=pageSize/>
      </div>
    </#if>
  </#if>
</#macro> 

<#macro channelList start=0 limit=5 maxWidth=0 dateFormat="">
  <#if (channel.id)??>
    <#local list = cms.getChannels(channel.id)/>
    <#if (list?size > 0) >
      <#list list as item>
        <div class="x-channel-content">
          <strong><@channelLink channel=item /></strong>
          <@channelChildren channel=item />
          <@channelArticles channel=item start=start limit=limit maxWidth=maxWidth dateFormat=dateFormat />
        </div>
      </#list>
    </#if>
  </#if>
</#macro>


  
